package com.ruoyi.market.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.market.domain.MarketCustomer;
import com.ruoyi.market.service.MarketCustomerService;
import com.ruoyi.market.mapper.MarketCustomerMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.xml.ws.soap.Addressing;
import java.util.List;

/**
* @author 1477507994
* @description 针对表【market_customer】的数据库操作Service实现
* @createDate 2022-01-04 14:52:31
*/
@Service
public class MarketCustomerServiceImpl extends ServiceImpl<MarketCustomerMapper, MarketCustomer>
    implements MarketCustomerService{

    @Autowired
    private  MarketCustomerMapper marketCustomerMapper;

    @Override
    public List<MarketCustomer> qureyCustomerList(MarketCustomer marketCustomer) {
        QueryWrapper<MarketCustomer> queryWrapper = Wrappers.query();
        if (StringUtils.isNotEmpty(marketCustomer.getName()))
        {
            queryWrapper.eq("name", marketCustomer.getName());
        }
        if (StringUtils.isNotEmpty(marketCustomer.getSex()))
        {
            queryWrapper.eq("sex", marketCustomer.getSex());
        }
        if (StringUtils.isNotEmpty(marketCustomer.getTelephone()))
        {
            queryWrapper.eq("telephone",marketCustomer.getTelephone());
        }
        if (StringUtils.isNotEmpty(marketCustomer.getCompany()))
        {
            queryWrapper.eq("company",marketCustomer.getCompany());
        }
        if (StringUtils.isNotNull(marketCustomer.getSysCityId()))
        {
            queryWrapper.eq("sys_city_id",marketCustomer.getSysCityId());
        }
        if (StringUtils.isNotNull(marketCustomer.getSysServiceUserId()))
        {
            queryWrapper.eq("sys_service_user_id",marketCustomer.getSysServiceUserId());
        }
        return marketCustomerMapper.selectList(queryWrapper);
    }
}




